import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import dts from 'vite-plugin-dts'

// https://vitejs.dev/config/
export default defineConfig({
  root: '.',
  build: {
    outDir: 'dist',
    lib: {
      entry: path.resolve(__dirname, 'src/index.ts'),
      name: 'blogui-mobile-vue',
      formats: ['es'],
      fileName: 'index',
    },
    rollupOptions: {
      external: ['vue'],
      output: {
        globals: { vue: 'Vue' },
      },
    },
  },
  plugins: [dts({ rollupTypes: true }), vue(), vueJsx({})],
  resolve: {
    alias: {
      '@hooks': path.resolve(__dirname, './src/_hooks'),
      '@utils': path.resolve(__dirname, './src/_utils'),
    },
  },
})
